<?php
//En variabel för att spara vilket restaurangnamn som skall användas
$q = $_GET["q"];

include("../conToDB.php");

$sql = "SELECT r_betyg, r_datum, r_anvandare, r_kommentar
		FROM rate
		WHERE p_id=(SELECT p_id FROM places 
			WHERE p_namn='" . $q . "')
		ORDER BY r_datum ASC";

$result = mysql_query($sql);

echo "<fieldset>
		<legend>Alla sparade besök</legend>";

while($row = mysql_fetch_array($result))
{
	echo "<table cellspacing='5px' style='border-bottom-style:dotted; border-bottom-color:#666; border-bottom-width:2px'>
			<tr>
    			<th>" . $row['r_anvandare'] . "</th>
        		<th>Kommentar</th>
    		</tr>
    		<tr>
    			<td><b>Datum:<br />" . $row['r_datum'] . "</b><br /><br />
				<b>Betyg: " . $row['r_betyg'] . "</b></td>
        		<td colspan='2'>" . $row['r_kommentar'] . "</td>
    		</tr>
		</table>";
}

echo "</fieldset>";

mysql_close($con);
?>